window.onload = function () {
  const arr = [
    {number:3092889699900293,plate:'京GA8765',model:'厢式货车',institution:'北京中转站',load:'2吨'},
    { number: 3091889599900292, plate: '京114514', model: '擎天柱同款货车', institution: '曹县中转站', load: '250吨' }
  ]
  const imgs = [
    './images/货车1.webp',
    './images/货车2.webp',
    './images/货车3.png',
    './images/货车4.jpg',
    './images/货车5.jpg'
  ]
  const button = document.querySelector('.button')
  const num = arr[Math.floor(Math.random() * 2)]
  const img = document.querySelector('.img')
  let sum=0
  button.innerHTML = `
  <div class="number b">
        <p>车辆信息</p>
        <span>${num.number}</span>
      </div>
      <div class="plate b">
        <p>车辆号牌</p>
        <span>${num.plate}</span>
      </div>
      <div class="model b">
        <p>车型</p>
        <span>${num.model}</span>
      </div>
      <div class="institution b">
        <p>所属机构</p>
        <span>${num.institution}</span>
      </div>
      <div class="load b">
        <p>载重</p>
        <span>${num.load}</span>
      </div>
  `
  
  
  //图片轮播图
  img.addEventListener('touchstart', () => {
    console.log(sum)
    img.src = imgs[sum]
    sum++
    if (sum > 4) {
      sum=0
    }
  })


  
// 退出操作
  const constent=document.querySelector('.header a img')
  constent.addEventListener('touchstart', function () {
    location.href='我的主页.html'
  })
}